<h1>Listing dns_cnames</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Pointing To</th>
    <th>External Name</th>
  </tr>

<% for dns_cname in @dns_cnames.sort{|a,b| a.name <=> b.name} %>
  <tr class=<%= cycle('row_odd','row_even')%> >
    <td>
      <%= link_to '[X]', dns_cname, :confirm => 'Are you sure?', :method => :delete %>  
      <%= link_to dns_cname.name, edit_dns_cname_path(dns_cname) %>
    </td>
    <td>
      <table>
        <% for o in dns_cname.cname_assets.sort{|a,b| a.name <=> b.name} %>
          <tr >
            <td>
               <%= o.name %>
             </td>
             <td>
               <%= o.primary_interface.ip_to_string rescue nil %>
            </td>
          </tr>
        <% end %>
      </table>      
    </td>
      <td>
        <%= dns_cname.external %>
      </td>
    
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New dns_cname', new_dns_cname_path %>
